function MyFavoritSongs(){
    this.MySongs = [ ];
    this.lastReturnedSong = null;
}

MyFavoritSongs.prototype.addSongs = function(songs){
    this.MySongs.push(songs);
}

MyFavoritSongs.prototype.toString = function(){
    var resultString = "";
    console.log(this.MySongs[0].songs);
    for(key in this.MySongs[0].songs){
        resultString += this.MySongs[0].songs[key] + ";";
    }
    return resultString;
}

MyFavoritSongs.prototype.getNextSongTitle = function(){
    if(this.lastReturnedSong == null){
        this.lastReturnedSong = 0;
    }else{
        this.lastReturnedSong++;
    }
    return this.MySongs[0].songs[this.lastReturnedSong];
}

songsP1 = new MyFavoritSongs();
songsP1.addSongs({ songs : { 0 : "Song1", 1: "Song2", 2: "Song3", 3: "Song4", 4: "Song2", 5: "Song3", 6: "Song4",}, });
console.log(songsP1.toString());
console.log(songsP1.getNextSongTitle());
console.log(songsP1.getNextSongTitle());
console.log(songsP1.getNextSongTitle());

songsP2 = new MyFavoritSongs();
songsP2.addSongs({ songs : { 0 : "Song1", 1: "Song2", 2: "Song3", 3: "Song4", 4: "Song2", 5: "Song3", 6: "Song4",}, });
console.log(songsP2.toString());
console.log(songsP2.getNextSongTitle());
console.log(songsP2.getNextSongTitle());
console.log(songsP2.getNextSongTitle());

songsP3 = new MyFavoritSongs();
songsP3.addSongs({ songs : { 0 : "Song1", 1: "Song2", 2: "Song3", 3: "Song4", 4: "Song2", 5: "Song3", 6: "Song4",}, });
console.log(songsP3.toString());
console.log(songsP3.getNextSongTitle());
console.log(songsP3.getNextSongTitle());
console.log(songsP3.getNextSongTitle());
